﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Admin_News_Register : System.Web.UI.Page
{
    // Declare Varibales    
    private NewsControl _NewsControl;
    private NewsDTO _NewsDTO;
    private DataTable _DT_Search;
        
    protected void Page_Load(object sender, EventArgs e)
    {
        _NewsControl = new NewsControl();
        _NewsDTO = new NewsDTO();
        _DT_Search = new DataTable();
    }
    protected void btn_Register_Click(object sender, EventArgs e)
    {
        try
        {
            _NewsDTO.News_Content = FTB_Tab.Text.Trim();
            if (Request.Cookies["Language"].Value.Equals("vi-VN"))
            {
                _NewsDTO.Language_ID = 2;
            }
            else
            {
                _NewsDTO.Language_ID = 1;
            }
            _NewsDTO.Tab_CreateDate = DateTime.Now;
            _NewsDTO.Tab_Active = true;
            if (_NewsDTO.InsertNews(_NewsDTO) == true)
            {
                Response.Redirect("news_list.aspx", false);
            }
        }
        catch (Exception ex)
        {
            Response.Redirect("error.aspx", false);
        }
        finally
        {
            GC.Collect();
        }
    }
}
